package com.itheima.exception;
import com.itheima.controller.DeptController;
import lombok.extern.slf4j.Slf4j;

import com.itheima.entity.Result;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    private static final org.slf4j.Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    @ExceptionHandler
    public Result DoException(Exception ex) {
        log.error(ex.getMessage());
        return Result.error("出错了，请联系管理员！");
    }

}
